﻿<%@ Page Title="" Language="C#" MasterPageFile="Site.Master" AutoEventWireup="true"  CodeBehind="Account.aspx.cs" Inherits="ResearchRepository.RRAccount" %>

<asp:Content ID="Content1" ContentPlaceHolderID="pageHead" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="pageContent" runat="server">
<table>
    <tr>
        <td>
            <label for="Email">Email</label>
        </td>
    </tr>
    <tr>
        <td>
            <label for="ChangeEmail">Change Email</label>
        </td>
        <td>
            <asp:CheckBox ID="ChangeEmail" OnCheckedChanged="OnCheckedEmail" runat="server" AutoPostBack="true"/>
        </td>
    </tr>
    <tr>
        <td>
            <label for="NewEmail">New Email:</label>
        </td>
        <td>
            <asp:Textbox id="NewEmail" runat="server" Enabled="false" MaxLength="40" />

            <asp:RegularExpressionValidator id="EmailFormatValidator1" runat="server" ValidationGroup="accountValidation"
            ControlToValidate="NewEmail" ErrorMessage="<span style='color:#FF0000'>Enter a valid email address<span>" 
            ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"  />
        </td>
    </tr>
    <tr>
        <td>
            <label for="NewEmailConfirm">Re-enter Email:</label>
        </td>
        <td>
            <asp:Textbox id="NewEmailConfirm" runat="server" enabled="false" MaxLength="40" />

            <asp:CompareValidator id="CompareEmailAddresses" ValidationGroup="accountValidation"
             runat="server" ErrorMessage="<span style='color:#FF0000'>Emails do not match!</span>" 
             ControlToValidate="NewEmailConfirm" ControlToCompare="NewEmail" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="Password">Password</label>
        </td>
    </tr>
    <tr>
        <td>
            <label for="ChangePassword">Change Password</label>
        </td>
        <td>
            <asp:CheckBox ID="ChangePassword" OnCheckedChanged="OnCheckedPassword" runat="server" AutoPostBack="true" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="NewPassword">New password:</label>
        </td>
        <td>
			<asp:Textbox id="NewPassword" runat="server" enabled="false" />

			<asp:RegularExpressionValidator ID="PasswordLengthValidator" runat="server" ValidationGroup="accountValidation"
			ControlToValidate="NewPassword"
			ErrorMessage="<span style='color:#FF0000'>Minimum password length is 8, and password may only user letters, numbers, and any of !@#$%^&*()</span>"
			ValidationExpression="[a-zA-Z0-9\)\(\*\&\^\%\$\#\@\!]{8,}" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="NewPasswordConfirm">Re-enter new password:</label>
        </td>
        <td>
            <asp:Textbox id="NewPasswordConfirm" runat="server" enabled="false" />

            <asp:CompareValidator id="ComparePasswords" ValidationGroup="accountValidation"
             runat="server" ErrorMessage="<span style='color:#FF0000'>Passwords do not match!</span>" 
             ControlToValidate="NewPasswordConfirm" ControlToCompare="NewPassword" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="FullName">Full Name</label>
        </td>
    </tr>
    <tr>
        <td>
            <label for="ChangeName">Change Name</label>
        </td>
        <td>
            <asp:CheckBox ID="ChangeName" OnCheckedChanged="OnCheckedChangeName" runat="server" AutoPostBack="true" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="PrefixTitles">Prefix Titles:</label>
        </td>
        <td>
            <asp:Textbox id="PrefixTitles" runat="server" enabled="false" MaxLength="30" />
            <asp:RegularExpressionValidator ID="prefixTextValidator" runat="server" ControlToValidate="PrefixTitles" ValidationGroup="accountValidation"
						ErrorMessage="<span style='color:#FF0000'>Only letters, commas, periods and spaces are allowed.</span>"
						ValidationExpression="^[a-zA-Z\,\. ]*$" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="FirstName">First Name:</label>
        </td>
        <td>
            <asp:Textbox id="FirstName" runat="server" enabled="false" MaxLength="30" />
            <asp:RegularExpressionValidator ID="firstNameTextValidator" runat="server" ControlToValidate="FirstName" ValidationGroup="accountValidation"
						ErrorMessage="<span style='color:#FF0000'>Only letters, dashes, periods and spaces are allowed.</span>" 
						ValidationExpression="^[a-zA-Z\-\. ]+$" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="MiddleName">Middle Name:</label>
        </td>
        <td>
            <asp:Textbox id="MiddleName" runat="server" enabled="false" MaxLength="30" />
            <asp:RegularExpressionValidator ID="middleNameTextValidator" runat="server" ControlToValidate="MiddleName" ValidationGroup="accountValidation"
						ErrorMessage="<span style='color:#FF0000'>Only letters, dashes, periods and spaces are allowed.</span>" 
						ValidationExpression="^[a-zA-Z\-\. ]+$" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="LastName">Last Name:</label>
        </td>
        <td>
            <asp:Textbox id="LastName" runat="server" enabled="false" MaxLength="30" />
            <asp:RegularExpressionValidator ID="lastNameTextValidator" runat="server" ControlToValidate="LastName" ValidationGroup="accountValidation"
						ErrorMessage="<span style='color:#FF0000'>Only letters, dashes, periods and spaces are allowed.</span>" 
						ValidationExpression="^[a-zA-Z\-\. ]+$" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="PostfixTitles">Postfix Titles:</label>
        </td>
        <td>
            <asp:Textbox id="PostfixTitles" runat="server" enabled="false" MaxLength="30" />
            <asp:RegularExpressionValidator ID="postfixTextValidator" runat="server" ControlToValidate="postfixTitles" ValidationGroup="accountValidation"
						ErrorMessage="<span style='color:#FF0000'>Only letters, commas, periods and spaces are allowed.</span>"
						ValidationExpression="^[a-zA-Z\,\. ]*$" />
        </td>
    </tr>
    <tr>
        <td>
            <label for="ChangeUniversityOrDept">Change University or Department</label>
        </td>
        <td>
            <asp:CheckBox ID="ChangeUniversityOrDept" OnCheckedChanged="OnCheckedChangeUniversityOrDept" runat="server" AutoPostBack="true"/>
        </td>
    </tr>
    <tr>
        <td />
        <td>
            <asp:RadioButton ID="NoUniversity" Enabled="false" runat="server" GroupName="University" AutoPostBack="true" oncheckedchanged="OnCheckedNoUniversity"/>
            <label for="NoUniversity">No university</label>
        </td>
        <td>
            <asp:RadioButton ID="NoDepartment" Enabled="false" runat="server" GroupName="Department" AutoPostBack="true" oncheckedchanged="OnCheckedNoDepartment"/>
            <label for="NoDepartment">No department</label>
        </td>
    </tr>
    <tr>
        <td />
        <td>
            <asp:RadioButton ID="KnownUniversity" Enabled="false" runat="server" GroupName="University" oncheckedchanged="OnCheckedKnownUniversity" AutoPostBack="true"/>
            <label for="KnownUniversity">University from list</label><br />
            <asp:Dropdownlist id="KnownUniversityList" runat="server" Enabled="false" AutoPostBack="true" OnSelectedIndexChanged="OnSelectedUniversityChanged"/>
        </td>
        <td>
            <asp:RadioButton ID="KnownDepartment" Enabled="false" runat="server" GroupName="Department" oncheckedchanged="OnCheckedKnownDepartment" AutoPostBack="true"/>
            <label for="KnownDepartment">Department from list</label><br />
            <asp:Dropdownlist id="KnownDepartmentList" runat="server" Enabled="false" />
        </td>
    </tr>
    <tr>
        <td />
        <td>            
            <asp:RadioButton ID="NewUniversity" Enabled="false" runat="server" GroupName="University" oncheckedchanged="OnCheckedNewUniversity" AutoPostBack="true"/>
            <label for="NewUniversity">New university</label><br />
            <asp:Textbox id="NewUniversityTextbox" runat="server" Enabled="false" MaxLength="50" />
            <asp:RegularExpressionValidator ID="newUnivTextValidator" runat="server" ControlToValidate="NewUniversityTextbox" ValidationGroup="accountValidation"
							ErrorMessage="<span style='color:#FF0000'>Only letters, commas, dashes, periods and spaces are allowed.</span>"
							ValidationExpression="^[a-zA-Z,\-\. ]+$" />
        </td>
        <td>            
            <asp:RadioButton ID="NewDepartment" Enabled="false" runat="server" GroupName="Department" oncheckedchanged="OnCheckedNewDepartment" AutoPostBack="true"/>
            <label for="NewDepartmentTextbox">New department</label><br />
            <asp:Textbox id="NewDepartmentTextbox" runat="server" Enabled="false" MaxLength="50" />
            <asp:RegularExpressionValidator ID="newDeptValidator" runat="server" ControlToValidate="NewDepartmentTextbox" ValidationGroup="accountValidation"
							ErrorMessage="<span style='color:#FF0000'>Only letters, commas, dashes, periods and spaces are allowed.</span>"
							ValidationExpression="^[a-zA-Z,\-\. ]+$" />
        </td>
    </tr>
    <tr>
        <td />
        <td>
            <asp:Button ID="ChangeAccountSubmit" runat="server" text="Submit" 
                Enabled="false" onclick="ChangeAccountSubmit_Click" CausesValidation="true"/>
        </td>
        <td>
            <asp:Button ID="ChangeAccountCancel" runat="server" text="Cancel" 
                onclick="ChangeAccountCancel_Click" CausesValidation="false"/>
        </td>
    </tr>
</table>

<div ID="successDiv" runat="server" visible="false">
    Your registration request has been submitted successfully and an additional confirmation e-mail has been sent.
</div>
<div ID="failureDiv" runat="server" visible="false">
    Your registration request has not been submitted due to a server error.
</div>

</asp:Content>